//
//  lyricsLabel.swift
//  QQMusic
//
//  Created by xmg on 16/9/8.
//  Copyright © 2016年 wlis. All rights reserved.
//

import UIKit

class lyricsLabel: UILabel {

    /** 定义歌词进度 */
    var progress : CGFloat = 0.0 {
        didSet {
            setNeedsDisplay()
        }
    }
    
    override func drawRect(rect: CGRect) {
        super.drawRect(rect)
        
        let drawRect = CGRect(x: 0, y: 0, width: rect.width * progress, height: rect.height)
        UIColor.greenColor().set()
        // UIRectFill(drawRect) 完全填充
        // R(最终控件的透明度) = S(填充的透明度)*Da(原有透明度)
        UIRectFillUsingBlendMode(drawRect, .SourceIn)
    }
}
